//
//  XFActiveManager.h
//  XFActiveView
//
//  Created by ukongm on 17/6/29.
//  Copyright © 2017年 ukongm. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

//自定义加载视图的必须实现的代理
@protocol XFActiveManagerDelegate <NSObject>

- (void)start;
- (void)stop;

@optional
//这两个方法如果不实现，则默认消失
- (void)success;
- (void)fail;

@end

/** 加载中的默认提示 */
static NSString* const XFSTATUS_ACTIVITING = @"正在努力加载";
/** 加载成功的默认提示 */
static NSString* const XFSTATUS_COMPLETE_SUCCESS = @"加载完毕";
/** 加载失败的默认提示 */
static NSString* const XFSTATUS_COMPLETE_FAIL = @"当前网络不佳";

/** 展示的宽度 */
static CGFloat const SHOW_WIDTH = 120;
/** 展示的高度 */
static CGFloat const SHOW_HEIGHT = 100;

//下面的配置对默认的提示框没有效果
/** 活动提示框展示的宽度 */
static CGFloat const ACTIVE_SHOW_WIDTH = 50;
/** 活动提示框展示的高度 */
static CGFloat const ACTIVE_SHOW_HEIGHT = 50;


typedef NS_ENUM(NSInteger,XFActiveManagerStatus) {
    
    XFActiveManagerStatusNone, //当前不显示的状态
    XFActiveManagerStatusActive, //加载中状态
    
    //下面的两种状态都是一瞬间的，处理状态时，没必要对其进行处理
    XFActiveManagerStatusActiveCompleteSuccess, //加载成功状态
    XFActiveManagerStatusActiveCompleteFail, //加载失败
    
//    XFActiveManagerStatusAnimationing, //正在动画过度期间
};

@interface XFActiveManager : NSObject


/** 接受代理的视图对象 */
@property(nonatomic,strong)UIView<XFActiveManagerDelegate>* activeView;

/** 当前的状态 */
@property(nonatomic,assign,readonly)XFActiveManagerStatus status;

- (void)showInView:(UIView*)superView;
- (void)showInView:(UIView*)superView value:(NSString*)value;

- (void)stopActive;

- (void)success;
- (void)successForValue:(NSString*)value;
- (void)successComplate:(void(^)(void))complate;
- (void)successForValue:(NSString*)value complate:(void(^)(void))complate;

- (void)fail;
- (void)failForValue:(NSString*)value;
- (void)failComplate:(void(^)(void))complate;
- (void)failForValue:(NSString*)value complate:(void(^)(void))complate;

#pragma mark - 提示
- (void)successHint:(NSString*)hint  complate:(void(^)(void))complate targetView:(UIView*)view;
- (void)failHint:(NSString*)hint  complate:(void(^)(void))complate targetView:(UIView*)view;

@end
